package com.atguigu.a_properties;

import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;

public class Demo3 {
    public static void main(String[] args) throws IOException {
        //创建属性集对象
        Properties properties = new Properties();
        System.out.println("properties = " + properties);

        //创建输入流对象
        FileReader fr = new FileReader("T_Day24\\test\\messages_ja.properties");

        //一键读取
        properties.load(fr); //利用输入流对象 一键把文件中的内容读取到集合中

        fr.close();


        //遍历集合
        Set<String> keys = properties.stringPropertyNames();
        for (String key : keys) {
            String value = properties.getProperty(key);

            System.out.println("key : " + key + " --- value : " + value);
        }
    }
}
